import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import nprogress from "nprogress"
Vue.use(VueRouter)


const router = new VueRouter({
  mode:"history",
  routes
})
router.beforeEach((to,from,next)=>{
  nprogress.start();
  if(to.meta && to.meta.title){
    document.title = to.meta.title;
  }
  next();
})

router.afterEach(()=>{
  nprogress.done();
})

export default router
